


















//判断某笔交易是否合法允许进行:
if ( bubi.isdonee( fromBubiId) ＆＆ !bubi.isinstitution(toBubiId) ) {
	end.add( "交易不成功，被捐助人只能向捐款使用机构转账，请确定交易双方是否正确") ;
	return end; 
}

//判断资金转出方是否为被捐助人:
public Boolean isdonee( String username) throws ClassNotFoundException，SQLException{
	//连接用户数据库
	String driver = "com.mysql.jdbc.Driver";
	Class.forName(driver) ;
	Connection conn = DriverManager.getConnection(
		"jdbc: mysql://localhost:3306/bubiAccount","username","password"
	);
	//判断输入值是否能与数据库被捐款人的姓名相匹配
	String string = "select tradeNo from donee where username = '" + username + "'";
	PreparedStatement ps = conn.prepareStatement(string) ;
	//若匹配成功，则返回 true，不成功则返回 false
	Boolean rs = ps.executeQuery( ).next( ) ;
	ps.executeQuery( ).close( ) ;
	ps.close( ) ;
	conn.close( ) ;
	return rs; 
}











//请求布比区块链接口获取单个用户交易信息:
String accessToken = factory.getOAuthService().getAccessToken(); 
//提供用户凭证
String url1 = "https://api.bubidev.cn/account/v1/transaction？bubi_address = " 
	+ BubiAddress + "＆access_token = " + accessToken; 
	//请求接口并提供用户 bubi 地址
String result = HttpKit.get(url1) ;


//遍历全部用户交易信息并提取不重复的全部用户交易信息:
for( int i = 0; i < address.size(); i++ ) {
	ArrayList <String[]>list1 = getUserTransFromWeb(address.get(i)); //调用getUserTransFromWeb函数
	Boolean check = false;
	for( int j = 0; j < list1.size() ; j++) {
		for( int a = 0; a < list.size() ; a++) {
			if ( list1.get(j)[1].equals(list.get(a)[1])＆＆list1.get(j)[2].equals(list.get(a)[2])＆＆list1.get(j)[3]． equals( list.get(a)[3])＆＆list1.get(j)[0].equals(list.get(a)[0]) ) {
				//判断是否重复
				check = true;
				break; 
			} 
		}
		if( check = = false) { 
			list.add( list1.get(j)) ; 
		}
	}
}